package request;

import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.Date;

/**
 * 演示请求分派，该 Servlet 用于接受分派的请求
 */
public class Reciver extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // 从 req 对象中取得前一个 Servlet 存放到属性域中的数据
        Date addTime = (Date) req.getAttribute("addTime");

        // 写入响应体
        resp.getWriter().println("This is a message from receiver!");
        resp.getWriter().println(addTime);
    }
}
